﻿<div ms-controller="tempview">

    <table class="sui-table table-primary table-zebra">
        <thead>
            <tr>
                <th>代码</th>
                <th>名称</th>
                <th>所属地区</th>
                <th style="width:150px">开通时间</th>
                <th>状态</th>
            </tr>
        </thead>
        <tbody>
            <tr ms-repeat-el="ListData">
                <td>{{el.Code}}</td>
                <td>{{el.CodeName}}</td>
                <td>{{el.Province+el.City}}</td>
                <td>{{el.CRTime|date('yyyy-MM-dd')}}</td>
                <td><span class="sui-text-success" ms-if="el.Status==1">正常</span><span class="sui-text-danger"  ms-if="el.Status==9">禁用</span></td>
            </tr>
        </tbody>
    </table>

</div>
<script type="text/javascript">
    var tempmodel = avalon.define({
        $id: "tempview",
        Init: function () {
            tempmodel.GetLIST();
        },
        GetLIST: function () {
            model.page.pageindex = 1;
            model.ListData.clear();
            $.getJSON("/adapi/base/client/list", { pageindex: model.page.pageindex, pagesize: model.page.pagesize }, function (r) {
                if (r.error == "") {
                    model.ListData = r.result;
                    model.total = r.total;

                    $("#pageDiv").pagination({  //分页容器
                        styleClass: ['sui-pagination'],  //分页样式
                        //showCtrl: false,
                        displayPage: 6,
                        itemsCount: r.total,
                        pageSize: model.page.pagesize,
                        onSelect: function (num) {
                            model.page.pageindex = num;
                            $.getJSON("/adapi/base/client/list", { pageindex: model.page.pageindex, pagesize: model.page.pagesize }, function (r) {
                                model.ListData.clear();
                                model.ListData = r.result;
                            })
                        }
                    })

                    $('#pageDiv').pagination('updateItemsCount', r.total, 1);
                }
            })
        }
    });

</script>
